home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / ObjectTcl-1.1 / CdlItem.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-30  |  4.8 KB  |  137 lines

  1. #ifndef CDL_ITEM_H
  2. #define CDL_ITEM_H
  3.  
  4. /*  _ __ ___ _
  5.  * | |\ /  /| |  $Id: CdlItem.H,v 1.8 1995/06/16 13:03:48 deans Exp $
  6.  * | | /  / | |  Copyright (C) 1995 IXI Limited.
  7.  * |_|/__/_\|_|  IXI Limited, Cambridge, England.
  8.  *
  9.  * Component   : CdlItem.H
  10.  *
  11.  * Author      : Dean Sheehan (deans@x.co.uk)
  12.  *  
  13.  * Description : Header file for CdlItem class that models items in the CDL
  14.  *               input file. Items are classes and pass commanded in the CDL
  15.  *               file.
  16.  *
  17.  * License     :
  18.             Object Tcl License & Copyright
  19.             -----------------------------
  20.  
  21. IXI Object Tcl software, both binary and source (hereafter, Software) is copyrighted by IXI Limited (IXI), and ownership remains with IXI. 
  22.  
  23. IXI grants you (herafter, Licensee) a license to use the Software for academic, research and internal business purposes only, without a fee. Licensee may distribute the binary and source code (if required) to third parties provided that the copyright notice and this statement appears on all copies and that no charge is associated with such copies. 
  24.  
  25. Licensee may make derivative works. However, if Licensee distributes any derivative work based on or derived from the Software, then Licensee will (1) notify IXI regarding its distribution of the derivative work, and (2) clearly notify users that such derivative work is a modified version and not the original IXI Object Tcl distributed by IXI. IXI strongly recommends that Licensee provide IXI the right to incorporate such modifications into future releases of the Software under these license terms. 
  26.  
  27. Any Licensee wishing to make commercial use of the Software should contact IXI, to negotiate an appropriate license for such commercial use. Commercial use includes (1) integration of all or part of the source code into a product for sale or license by or on behalf of Licensee to third parties, or (2) distribution of the binary code or source code to third parties that need it to utilize a commercial product sold or licensed by or on behalf of Licensee. 
  28.  
  29. IXI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. IXI SHALL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER SUFFERED BY THE USERS OF THIS SOFTWARE. 
  30.  
  31. Copyright (C) 1995, IXI Limited 
  32.  
  33. By using or copying this Software, Licensee agrees to abide by the copyright law and all other applicable laws of England and the U.S., including, but not limited to, export control laws, and the terms of this license. IXI shall have the right to terminate this license immediately by written notice upon Licensee's breach of, or non-compliance with, any of its terms. Licensee may be held legally responsible for any copyright infringement that is caused or encouraged by Licensee's failure to abide by the terms of this license. 
  34.  
  35. Comments and questions are welcome and can be sent to
  36. otcl@x.co.uk 
  37.  
  38. For more information on copyright and licensing issues, contact: 
  39. Legal Department, IXI Limited, Vision Park, Cambridge CB4 4ZR,
  40. ENGLAND. 
  41.  
  42.  *
  43.  */
  44.  
  45. // System Includes
  46. #include <fstream.h>
  47.  
  48. // Local Includes
  49.  
  50. // Forward Class Declarations
  51. class CdlMethod;
  52. class CdlInstanceMethod;
  53. class CdlClassMethod;
  54. class CdlConstructor;
  55.  
  56. // Public Defines
  57. #define MAX_METHODS 50
  58.  
  59. // Facilitates indentation of C++ code.
  60. #define TAB 3
  61. class CdlIndent
  62. {
  63.    friend ofstream &operator << (ofstream &, CdlIndent &);
  64. public:
  65.    CdlIndent (int number);
  66.    CdlIndent &operator ++ (int);
  67.    CdlIndent &operator ++ ();
  68.    CdlIndent &operator -- (int);
  69.    CdlIndent &operator -- ();
  70. private:
  71.    int spaces;
  72. };
  73.  
  74. class CdlItem {
  75. public:
  76.    CdlItem ();
  77.     virtual ~CdlItem ();
  78.    virtual int genHeader (ofstream &) = 0;
  79.    virtual int genSource (ofstream &) = 0;
  80. };
  81.  
  82. class CdlPass : public CdlItem 
  83. {
  84. public:
  85.  
  86.    enum Position {HEADER, SOURCE, HEADER_AND_SOURCE};
  87.  
  88.    CdlPass (char *);
  89.    CdlPass (char *, char *);
  90.  
  91.    ~CdlPass ();
  92.    int genHeader (ofstream &);
  93.    int genSource (ofstream &);
  94. private:
  95.    Position pos;
  96.    char *line;
  97. };
  98.  
  99. class CdlClass : public CdlItem
  100. {
  101. public:
  102.  
  103.    CdlClass (char *name, int noOfSuperclasses, char *superclasses[]);
  104.    ~CdlClass ();
  105.  
  106.    int genHeader (ofstream &);
  107.    int genSource (ofstream &);
  108.    void addInstanceMethod (CdlInstanceMethod *);
  109.    void addClassMethod (CdlClassMethod *);
  110.    void setConstructor (CdlConstructor *);
  111.    CdlConstructor *getConstructor (void);
  112.    char *giveName (void);
  113.  
  114. private: // Private Instance Methods
  115.  
  116.    void genOtclClassDec (ofstream &);
  117.    void genOtclClassDef (ofstream &);
  118.    void genOtclPartDec (ofstream &);
  119.    void genOtclPartDef (ofstream &);
  120.  
  121. private: // Private Instance Attributes
  122.  
  123.    CdlInstanceMethod *instanceMethod[MAX_METHODS];
  124.    int noOfInstanceMethods;
  125.  
  126.    CdlClassMethod *classMethod[MAX_METHODS];
  127.    int noOfClassMethods;
  128.  
  129.    CdlConstructor *constructor;
  130.    char *name;
  131.  
  132.    int noOfSuperclasses;
  133.    char **superclasses;
  134. };
  135.  
  136. #endif
  137.